package com.heima.user.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.FollowDto;
import com.heima.model.user.pojos.ApUserFollow;
import com.heima.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: JW
 * @Description: TODO
 * @DateTime: 2022-02-19 16:36
 **/
@RestController
@RequestMapping("/api/v1/user")
public class UserController {


    @Autowired
    private UserService userService;

    /**
     * @Author: JW
     * @Description:  TODO 关注
     * @Date: 10:50 2022-02-20
     * @Param: [followDto]
     * @return: com.heima.model.common.dtos.ResponseResult
    **/
    @PostMapping("/user_follow/")
    public ResponseResult  follow(@RequestBody FollowDto followDto){

        return userService.follow(followDto);
    }

    @GetMapping("/user_getFollow/{userId}/{authorId}")
    public ApUserFollow getFollowInfo(@PathVariable Integer userId, @PathVariable Integer authorId){

        return userService.getFollowInfo(userId, authorId);
    }
}
